<DataForm
  @dc={{dc}}
  @nspace={{nspace}}
  @item={{item}}
  @type="session"
  @onsubmit={{action onsubmit}}
  as |api|
>
  <BlockSlot @name="form">
      <div class="definition-table" data-test-session={{api.data.ID}}>
        <h2>
          <a href="{{env 'CONSUL_DOCS_URL'}}/internals/sessions.html#session-design" rel="help noopener noreferrer" target="_blank">Lock Session</a>
        </h2>
        <dl>
          <dt>Name</dt>
          <dd>{{api.data.Name}}</dd>
          <dt>Agent</dt>
          <dd>
              <a href={{href-to 'dc.nodes.show' api.data.Node}}>{{api.data.Node}}</a>
          </dd>
          <dt>ID</dt>
          <dd>{{api.data.ID}}</dd>
          <dt>Behavior</dt>
          <dd>{{api.data.Behavior}}</dd>
{{#if form.data.Delay }}
          <dt>Delay</dt>
          <dd>{{api.data.LockDelay}}</dd>
{{/if}}
{{#if form.data.TTL }}
          <dt>TTL</dt>
          <dd>{{api.data.TTL}}</dd>
{{/if}}
{{#if (gt api.data.Checks.length 0)}}
          <dt>Health Checks</dt>
          <dd>
              {{ join ', ' api.data.Checks}}
          </dd>
{{/if}}
        </dl>
        <ConfirmationDialog @message="Are you sure you want to invalidate this session?">
          <BlockSlot @name="action" as |confirm|>
            <button type="button" data-test-delete class="type-delete" {{action confirm api.delete session}} disabled={{api.disabled}}>Invalidate Session</button>
          </BlockSlot>
          <BlockSlot @name="dialog" as |execute cancel message|>
            <p>
              {{message}}
            </p>
            <button type="button" class="type-delete" {{action execute}}>Confirm Invalidation</button>
            <button type="button" class="type-cancel" {{action cancel}}>Cancel</button>
          </BlockSlot>
        </ConfirmationDialog>
      </div>
    </BlockSlot>
</DataForm>